#include <stdio.h>
int binary_one_1(unsigned int num);
int binary_one_2(int num);
//统计数据中2进制中1的个数
int main()
{   int num = -1;
//    printf("%d\n",(unsigned int)num);
//    scanf("%d", &num);
//    int n = binary_one_1(num);
//    printf("%d\n",n);

    int n1 = binary_one_2(num);
   printf("%d\n",n1);
    return 0;
}

int binary_one_1(unsigned int num)
{   int count = 0;
    //采用>>右移方法
    while (num)
    {
        if(num & 1)
            count++;
        num = num>>1;
    }
    return  count;
}

int binary_one_2(int num)
{   int count = 0;
    //采用n&(n-1)方法
    while (num)
    {
        num = num & (num - 1);
        count++;
    }
    return  count;
}